package com.biz.primus.ms.stock.feign;

import com.biz.primus.model.depot.vo.DepotRespVo;
import com.biz.primus.model.depot.vo.SearchDepotConditionVo;
import com.biz.primus.ms.stock.degraded.DegradedDepotFeignClient;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Optional;

/**
 * DepotFeignClient
 *
 * @author JKLiues
 * @date 2017/10/21
 */
@FeignClient(qualifier = "depotFeignClient", name = "service-depot", fallback = DegradedDepotFeignClient.class)
public interface DepotFeignClient {

    /**
     * 从缓存中查询指定门店
     *
     * @param depotCode 门店编码
     * @return Optional<DepotRespVo>
     */
    @PostMapping("soa/depotService/getByDepotCodeFRdb")
    Optional<DepotRespVo> findDepotByDepotCode(@RequestParam("depotCode") String depotCode);

    /**
     * 搜索附近门店
     *
     * @param vo 搜索条件
     * @return List<DepotRespVo>
     */
    @PostMapping("soa/depotService/findNearDepot")
    List<DepotRespVo> findNearDepot(@RequestBody SearchDepotConditionVo vo);

    /**
     * 通过区域ID查门店
     *
     * @param geoId 区域ID
     * @return List<DepotRespVo>
     */
    @GetMapping("soa/depotService/findDepotsByGeoId")
    List<DepotRespVo> findDepotsByGeoId(@RequestParam("geoId") Long geoId);

    /**
     * 查全部的总仓
     *
     * @return List<DepotRespVo>
     */
    @GetMapping("soa/depotService/getAllCenterDepots")
    List<DepotRespVo> getAllCenterDepots();

    /**
     * 查全部的太原店
     *
     * @return List<DepotRespVo>
     */
    @GetMapping("soa/depotService/getAllHomeDepots")
    List<DepotRespVo> getAllHomeDepots();

}
